﻿using HslCommunication;
using HslCommunication.ModBus;
using System;

namespace DifferentDLLVersionCompatible
{
    /// <summary>
    /// 合并dll方法
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {
            ModbusRtu modbusRtu = new ModbusRtu();
            OperateResult<byte[]> res = modbusRtu.ReadBase(new byte[1]);
            Console.WriteLine(res.ToJsonString());
            Console.Read();
        }
    }

    //public static class Sss
    //{

    //    public static OperateResult<byte[]> ReadBase(this ModbusRtu modbusRtu,byte[] send)
    //    {
    //        return ReadBase(send, false);
    //    }

    //    public static OperateResult<byte[]> ReadBase(byte[] send, bool sendOnly)
    //    {
    //        LogNet?.WriteDebug(ToString(), StringResources.Language.Send + " : " + (LogMsgFormatBinary ? send.ToHexString(' ') : Encoding.ASCII.GetString(send)));
    //        hybirdLock.Enter();
    //        OperateResult operateResult = Open();
    //        if (!operateResult.IsSuccess)
    //        {
    //            hybirdLock.Leave();
    //            return OperateResult.CreateFailedResult<byte[]>(operateResult);
    //        }
    //        if (IsClearCacheBeforeRead)
    //        {
    //            ClearSerialCache();
    //        }
    //        OperateResult operateResult2 = SPSend(sP_ReadData, send);
    //        if (!operateResult2.IsSuccess)
    //        {
    //            hybirdLock.Leave();
    //            return OperateResult.CreateFailedResult<byte[]>(operateResult2);
    //        }
    //        if (sendOnly)
    //        {
    //            hybirdLock.Leave();
    //            return OperateResult.CreateSuccessResult(new byte[0]);
    //        }
    //        OperateResult<byte[]> operateResult3 = SPReceived(sP_ReadData, true);
    //        hybirdLock.Leave();
    //        LogNet?.WriteDebug(ToString(), StringResources.Language.Receive + " : " + (LogMsgFormatBinary ? operateResult3.Content.ToHexString(' ') : Encoding.ASCII.GetString(operateResult3.Content)));
    //        return operateResult3;
    //    }
    //}
}
